<template>
  <div class="com">
    
    <!-- 评论功能 -->
    <Comment :imgId="$route.params.id" :page="page" @addPage="gocommen"></Comment>
  </div>
</template>
           
<script>
import Comment from "../common/Comment";

import {postcom} from "@/api"
export default {
  components:{Comment},
  data() {
    return {
      comvalue: "",
      page:1
    };
  },
  methods: {
   async gocommen(id) {
      if (this.comvalue.trim().length == 0) {
        this.$toast("评论不能为空");
      } else {
        var qq={
         content:this.comvalue,
         id:id
        }
      var res=await postcom(qq)
      if(res.data.status!=0){
        this.$toast("请求服务器失败");}
      }
    },
    goc() {
      this.page ++ 
    }
  }
};
</script>
<style scoped lang=less>
.com{
  padding: 0 10px;
  box-sizing: border-box;
}
</style>